package com.meiyu.live.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.ImageView;

/**
 * Created by zbl on 2016/12/21.
 */
public class AnimImageViewButton extends ImageView {

    boolean isShow = true;

    public AnimImageViewButton(Context context) {
        super(context);
    }

    public AnimImageViewButton(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public AnimImageViewButton(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        if (isShow) {
            return super.onTouchEvent(event);
        } else {
            return false;
        }
    }

    @Override
    public void setVisibility(int visibility) {
        if (visibility == VISIBLE) {
            isShow = true;
            setAlpha(1f);
        } else {
            isShow = false;
            setAlpha(0f);
        }
    }
}
